﻿using FlowCanvas;
using FlowCanvas.Nodes;

namespace Yoozoo.Gameplay.Liberty.StreetEvent
{
    public class MonsterKillEvent : EventNode
    {
        private FlowOutput onKill;
        public override string name
        {
            get
            {
                return "StreetEvent_MonsterKill";
            }
        }

        protected override void RegisterPorts()
        {
            onKill = AddFlowOutput("Out");
        }

        public override void OnPostGraphStarted()
        {
            StreetEventManager.OnKillMonsterAction += OnKillMonster;
        }
        
        public override void OnPostGraphStoped()
        {
            StreetEventManager.OnKillMonsterAction -= OnKillMonster;
        }

        private void OnKillMonster(int uniqueId)
        {
            onKill.Call(new Flow());
        }
    }
}